<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class News extends WxHomeController {

	function __construct() {
		parent::__construct();
		$this -> sidebar = "News";
		
	}
	function Index(){
		$this -> load -> model("Supervisor_feedback_model");
		$connar=array();
		$connar['items']="db_admin.id,db_admin.username,db_supervisor_feedback.content,db_supervisor_feedback.status";
		$connar['join'][0]=array("db_admin","db_admin.id=db_supervisor_feedback.belong");
		$connar['join'][1]=array("db_supervisor_feedback_record r","r.feedback_id=db_supervisor_feedback.id and r.admin_id=db_supervisor_feedback.belong");
		$connar['where']=$this->sqlEscape("db_supervisor_feedback.belong=??",array($_SESSION[SESS_USER_HOME]['id']));
		$connar['orderby']="db_supervisor_feedback.created desc";
		$result['feedback']=$this -> Supervisor_feedback_model -> get_list_full($connar);
		foreach ($result['feedback'] as $k => $v) {
			$result['feedback'][$k]['status']=(new FeedBackStatus)->show($result['feedback'][$k]['status']);
			if($result['feedback'][$k]['status']==FeedBackStatus::ToAudit[XPHEnum::Caption]){
				$result['feedback'][$k]['sty_color']="style='color:#FF0000'";
			}else if($result['feedback'][$k]['status']==FeedBackStatus::HaveWrite[XPHEnum::Caption]){
				$result['feedback'][$k]['sty_color']="style='color:#26A100'";
			}
		}
		$this -> load ->view("home/news",$result);
	}

}